package com.itheima.mapper;

import com.itheima.entity.Count;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CountMapper {


    @Select("select case gender when 1 then '男性员工' when 2 then '女性员工'end as name, count(*) as value from emp group by gender")
    List<Count> getEmpGenderData();

    @Select("select case job when 1 then '班主任' when 2 then '讲师' when 3 then '学工主管' when 4 then '教研主管'" +
            " when 5 then '咨询师' when 6 then '其他' end as name, count(*) as value from emp group by job")
    List<Count> getEmpJobData();

//    1: 初中, 2: 高中 , 3: 大专 , 4: 本科 , 5: 硕士 , 6: 博士
    @Select("select case degree when 1 then '初中' when 2 then '高中' when 3 then '大专' when 4 then '本科'" +
            " when 5 then '硕士' when 6 then '博士' end as name, count(*) as value from student group by degree")
    List<Count> getStudentDegreeData();

    @Select("select c.name name, count(*) value from student s left join clazz c on c.id = s.clazz_id group by c.name")
    List<Count> getStudentClazzData();
}
